package com.rfsp.common.util;

import java.util.Locale;
import java.util.ResourceBundle;

public class PropUtil {
	/**
	 * 读取配置文件
	 * @param key
	 * @return
	 */
	private static String getProperty(String relativeFilePath, String key){
		String result = "";
		try{
			ResourceBundle resouces;
			resouces = ResourceBundle.getBundle(relativeFilePath, Locale.getDefault());
			result = resouces.getString(key);
		}catch(Exception e){
			throw new RuntimeException("系统参数读取失败("+key+")");
		}
		return result;
	}
	
	/**
	 * 读取系统参数
	 * @param key
	 * @return
	 */
	public static String getSystemProperty(String key){
		return getProperty("config", key);
	}
	
	/**
	 * 读取提示信息
	 * @param key
	 * @return
	 */
	public static String getInfoProperty(String key){
		return getProperty("properties.info", key);
	}
	
	/**
	 * 读取错误信息
	 * @param key
	 * @return
	 */
	public static String getErrorProperty(String key){
		//return getProperty("properties.error", key);
		return getProperty("error", key);
	}
}

